import router from '..'

const isHash = (href: string) => {
  return /^#/.test(href)
}
const body = document.body

router.afterEach(async (to) => {
  // scroll top
  isHash((to as any & { href: string })?.href) && body.scrollTo(0, 0)
  return true
})
